import 'package:cbec_app/generated/json/base/json_convert_content.dart';
import 'package:cbec_app/components/decoration/DecorationRedPacket/red_packet_Item_entity.dart';

RedPacketItemEntity $RedPacketItemEntityFromJson(Map<String, dynamic> json) {
  final RedPacketItemEntity redPacketItemEntity = RedPacketItemEntity();
  final String? redPacketId = jsonConvert.convert<String>(json['redPacketId']);
  if (redPacketId != null) {
    redPacketItemEntity.redPacketId = redPacketId;
  }
  final String? marketingId = jsonConvert.convert<String>(json['marketingId']);
  if (marketingId != null) {
    redPacketItemEntity.marketingId = marketingId;
  }
  final String? redPacketUserId = jsonConvert.convert<String>(json['redPacketUserId']);
  if (redPacketUserId != null) {
    redPacketItemEntity.redPacketUserId = redPacketUserId;
  }
  final String? redPacketName = jsonConvert.convert<String>(json['redPacketName']);
  if (redPacketName != null) {
    redPacketItemEntity.redPacketName = redPacketName;
  }
  final double? price = jsonConvert.convert<double>(json['price']);
  if (price != null) {
    redPacketItemEntity.price = price;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    redPacketItemEntity.content = content;
  }
  final String? goodsType = jsonConvert.convert<String>(json['goodsType']);
  if (goodsType != null) {
    redPacketItemEntity.goodsType = goodsType;
  }
  final int? goodsTypeValue = jsonConvert.convert<int>(json['goodsTypeValue']);
  if (goodsTypeValue != null) {
    redPacketItemEntity.goodsTypeValue = goodsTypeValue;
  }
  final String? goodsTypeValueId = jsonConvert.convert<String>(json['goodsTypeValueId']);
  if (goodsTypeValueId != null) {
    redPacketItemEntity.goodsTypeValueId = goodsTypeValueId;
  }
  final int? hasGet = jsonConvert.convert<int>(json['hasGet']);
  if (hasGet != null) {
    redPacketItemEntity.hasGet = hasGet;
  }
  final int? getLimit = jsonConvert.convert<int>(json['getLimit']);
  if (getLimit != null) {
    redPacketItemEntity.getLimit = getLimit;
  }
  final int? validityType = jsonConvert.convert<int>(json['validityType']);
  if (validityType != null) {
    redPacketItemEntity.validityType = validityType;
  }
  final String? startTime = jsonConvert.convert<String>(json['startTime']);
  if (startTime != null) {
    redPacketItemEntity.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['endTime']);
  if (endTime != null) {
    redPacketItemEntity.endTime = endTime;
  }
  final String? useDate = jsonConvert.convert<String>(json['useDate']);
  if (useDate != null) {
    redPacketItemEntity.useDate = useDate;
  }
  final int? ruleType = jsonConvert.convert<int>(json['ruleType']);
  if (ruleType != null) {
    redPacketItemEntity.ruleType = ruleType;
  }
  return redPacketItemEntity;
}

Map<String, dynamic> $RedPacketItemEntityToJson(RedPacketItemEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['redPacketId'] = entity.redPacketId;
  data['marketingId'] = entity.marketingId;
  data['redPacketUserId'] = entity.redPacketUserId;
  data['redPacketName'] = entity.redPacketName;
  data['price'] = entity.price;
  data['content'] = entity.content;
  data['goodsType'] = entity.goodsType;
  data['goodsTypeValue'] = entity.goodsTypeValue;
  data['goodsTypeValueId'] = entity.goodsTypeValueId;
  data['hasGet'] = entity.hasGet;
  data['getLimit'] = entity.getLimit;
  data['validityType'] = entity.validityType;
  data['startTime'] = entity.startTime;
  data['endTime'] = entity.endTime;
  data['useDate'] = entity.useDate;
  data['ruleType'] = entity.ruleType;
  return data;
}

extension RedPacketItemEntityExtension on RedPacketItemEntity {
  RedPacketItemEntity copyWith({
    String? redPacketId,
    String? marketingId,
    String? redPacketUserId,
    String? redPacketName,
    double? price,
    String? content,
    String? goodsType,
    int? goodsTypeValue,
    String? goodsTypeValueId,
    int? hasGet,
    int? getLimit,
    int? validityType,
    String? startTime,
    String? endTime,
    String? useDate,
    int? ruleType,
  }) {
    return RedPacketItemEntity()
      ..redPacketId = redPacketId ?? this.redPacketId
      ..marketingId = marketingId ?? this.marketingId
      ..redPacketUserId = redPacketUserId ?? this.redPacketUserId
      ..redPacketName = redPacketName ?? this.redPacketName
      ..price = price ?? this.price
      ..content = content ?? this.content
      ..goodsType = goodsType ?? this.goodsType
      ..goodsTypeValue = goodsTypeValue ?? this.goodsTypeValue
      ..goodsTypeValueId = goodsTypeValueId ?? this.goodsTypeValueId
      ..hasGet = hasGet ?? this.hasGet
      ..getLimit = getLimit ?? this.getLimit
      ..validityType = validityType ?? this.validityType
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..useDate = useDate ?? this.useDate
      ..ruleType = ruleType ?? this.ruleType;
  }
}
